import axios from '../../utils/request';

/**
 * 模块名:教室
 */

// 创建
export function created(data: { class_room_name: string; capacity: number }) {
  return axios.request({
    url: '/class-rooms',
    method: 'post',
    data,
  });
}

// 列表
export function list() {
  return axios.request({
    url: '/class-rooms',
    method: 'get',
  });
}

// 详情
export function detail(id: number) {
  return axios.request({
    url: '/class-rooms/' + id,
    method: 'get',
  });
}

// 更新
export function update(id: number, data: { class_room_name: string; capacity: number }) {
  return axios.request({
    url: '/class-rooms/' + id,
    method: 'patch',
    data,
  });
}

// 删除
export function del(id: number) {
  return axios.request({
    url: '/class-rooms/' + id,
    method: 'delete',
  });
}

export default {
  created,
  list,
  detail,
  update,
  del,
};
